#ifndef MAINWIDGET_H
#define MAINWIDGET_H

#include <QWidget>
#include "./Common/config.h"
#include "./Function/register.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWidget; }
QT_END_NAMESPACE

class SQLManagement;
class UserManagementBase;
class DoctorManagement;
class PatientManagement;
class AppointmentManagement;
class AdviceManagement;
class PrescriptionManagement;
class MedicalRecordManagement;
class Widget_doctor;
class Widget_patient;

class MainWidget : public QWidget
{
    Q_OBJECT

public:
    MainWidget(QWidget *parent = nullptr);
    void initSignalSlot();
    void initStyleSheet();
    void initSqlConnection();
    void initControl();
    ~MainWidget();

private:
    inline bool isUserValid(const QString &username, const QString& passwd, const QString& id, const int& flag);

public slots:
    void handleDoctorChatRequest();
    void handlePatientChatRequest();

private slots:

    void login_btn_clicked();
    void register_btn_clicked();

private:

    Ui::MainWidget *ui;
    SQLManagement* sql_management;
    UserManagementBase* user_management;
    DoctorManagement* doctor_management;
    PatientManagement* patient_management;
    AppointmentManagement* appointment_management;
    AdviceManagement* advice_management;
    PrescriptionManagement* prescription_management;
    MedicalRecordManagement* medicalRecord_management;
    Widget_doctor* widget_doctor;
    Widget_patient* widget_patient;
};
#endif // MAINWIDGET_H
